// 假设你有一个包含链接的数组  
const links = [
    { href: 'http://101.133.132.75:911', name: "核弹监控", id: "nuker" },
    { href: 'http://101.133.132.75:9959', name: "可道云", id: "pan" },
    { href: 'http://101.133.132.75:9960', name: "测试页面", id: "test" },
    { href: 'http://101.133.132.75:11111', name: "PQ任务", id: "pq" },
    { href: 'http://101.133.132.75:20418', name: "日记本", id: "riji" },
    { href: 'http://101.133.132.75:20419', name: "白色相簿", id: "xiangce" },
    { href: 'http://101.133.132.75:20420', name: "体育计算器", id: "tiyu" },
    { href: 'http://101.133.132.75:20423', name: "PDF工具", id: "pdf" },
    { href: 'https://blog.mofengfeng.com', name: "mffapi", id: "mffapi" },
    { href: 'https://screeps-cn.github.io/api', name: "screepsapi", id: "screepsapi" },
    { href: 'https://www.zsuuu.com/download.html', name: "screepsdownload", id: "screepsdownload" }
];

links.forEach(async (link) => {
    try {
        const response = await fetch(link.href, { method: 'HEAD' }); // 使用 HEAD 方法仅获取响应头  
        // console.log(link.name, "=>", response.status)
        if (response.status == 200) {
            try {
                document.getElementById(link.id).style.backgroundColor = "green"
                console.log(link.name, "√")
            } catch (error) {
                console.log(link.name, "X")
            }
        }
    } catch (error) {
        // 处理错误，例如网络错误或 CORS 问题  
        console.log(link.name, "XX");

    }
});